<template>
  <div>
    <div class="footer_wrap">
      <!-- 通过路径path  跳转 -->

      <!-- <a href="javascript:;"  @click="skip('/find')">发现音乐</a>
      <a href="javascript:;"    @click="skip('/my')">我的音乐</a>
      <a href="javascript:;"  @click="skip('/part')">朋友</a> -->
      <!-- <router-link to="/find">发现音乐</router-link>
      <router-link  to="/my">我的音乐</router-link>
      <router-link  to="/part?uname=张三&age=18">朋友</router-link>
      <router-link  to="/part">朋友</router-link> -->
      <!-- 通过name 跳转 -->
      <a href="javascript:;" @click="skipName('find')">发现音乐</a>
      <a href="javascript:;" @click="skipName('my')">我的音乐</a>
      <a href="javascript:;" @click="skipName('part')">朋友</a>
      <a href="javascript:;" @click="skipNameTwo">朋友2222</a>
    </div>
    <div class="top">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    skipNameTwo() {
      this.$router.push({
        name: "part",
        // params 传参需要通过name跳转 ，通过路径path跳转 ，params 无效
        params: {
          username: "李四",
          age: 16,
        },
        query: {
          uname: "张三",
          ager: 16,
        },
      });
    },
    skip(path) {
      this.$router.push({
        path,
      });
    },
    skipName(name) {
      this.$router.push({
        name,
        query: {
          uname: "张三",
          age: 16,
        },
      });
    },
  },
};
</script>

<style scoped>
.footer_wrap {
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  width: 100%;
  text-align: center;
  background-color: #333;
  color: #ccc;
}
.footer_wrap a {
  flex: 1;
  text-decoration: none;
  padding: 20px 0;
  line-height: 20px;
  background-color: #333;
  color: #ccc;
  border: 1px solid black;
}
.footer_wrap a:hover {
  background-color: #555;
}
.top {
  padding-top: 62px;
}
.footer_wrap .router-link-exact-active.router-link-active {
  background-color: skyblue;
  color: blueviolet;
}
</style>